var vote = new Vue({
    el: '#Votelist',
    data: {
        userId: $("#id").val(),
        xiangmuId: $("#xiangmuId").val(),
        xiangmuleixing: $("#xiangmuleixing").val(),
        tiaojian: '',
        detailid: "",
        pinzhong: "",
        pinpai: "",
        pinpaixuhaos: "",
        ids: "",
        xiangmu: {},
        shiyongyuanze: {},
        yiyongyuanze: {},
        syyz_value: [],
        shiyongyuanzelist: [],
        votelist: [],
        show: false,
        total: 0,
        yitongyishu: 0,
        tongyishu: 0,
        butongyishu: 0,
        checkAll: false,
        checkedCities: [],
        isIndeterminate: true,
        issubmited: false,

        pageIndex: 1,
        pageSize: 9999,
        pageCount: 0,
        recordCount: 0,
        inputPageIndexValue: "",
    },
    created: function () {
        var _this = this;

        $(".nav navbar-nav li").removeClass("active");
        $("#nav_biaojue").addClass("active");
        _this.findIsacticed();


    },
    mounted() {

    },
    methods: {
        openSelect() {
            console.log(123)
            this.$refs.selectRef.toggleMenu();
        },
        handleCheckAllChange(val) {
            var ids = this.shiyongyuanzelist.map(item => {
                return item.id
            })
            this.syyz_value = val ? ids : [];
            this.isIndeterminate = false;
            console.log(this.checkedCities)
        },
        handleCheckedCitiesChange(value) {
            var ids = this.shiyongyuanzelist.map(item => {
                return item.id
            })
            let checkedCount = value.length;
            this.checkAll = checkedCount === ids.length;
            this.isIndeterminate = checkedCount > 0 && checkedCount < ids.length;
            this.syyz_value = value
        },
        findIsacticed: function () {
            var _this = this;
            layer.open({type: 3});
            $.post('/xiangmu/getIsactivedxiangmu', {
                rdm: Math.random()
            }, function (ppData) {
                layer.closeAll("loading");
                if (ppData != null) {
                    if (ppData.result == "1") {
                        var data = ppData.resultContent;
                        _this.xiangmu = data;
                        _this.xiangmuId = _this.xiangmu.xiangmuid;
                        _this.xiangmuleixing = data.xiangmuleixing;
                        _this.findBiaojuelist();
                        _this.getResultCount();
                        _this.checkIsSubmited();
                        _this.initDict();
                    } else {
                        layer.alert(ppData.message);
                    }
                }
            }, "json");
        },
        initDict: function () {

            var _this = this;
            $.post("/dict_shiyongyuanze/find_all", {
                text: "",
                rdm: Math.random()
            }, function (ppData) {
                if (ppData != null) {
                    if (ppData.result == '1') {
                        _this.shiyongyuanzelist = ppData.resultContent;
                    } else {
                        layer.alert(ppData.message);
                    }
                }
            }, "json");
        },
        syyzChange: function (val) {
            this.syyz_value = val
        },
        findBiaojuelist: function () {
            var _this = this;
            layer.open({type: 3});
            $.post("/hc45/findBiaojuelist", {
                xiangmuid: _this.xiangmuId,
                userid: _this.userId,
                tiaojian: _this.tiaojian,
                pageindex: _this.pageIndex,
                pagesize: _this.pageSize,
                rdm: Math.random()
            }, function (ppData) {
                layer.closeAll("loading");
                if (ppData != null) {
                    if (ppData.result == "1") {
                        var data = ppData.resultContent;
                        var mmHtml = "<div class='table-head'><table class=\"table table-hover table-bordered\" style=\"overflow:hidden; margin-bottom:10px;table-layout:fixed;\" v-if=\"show\" cellspacing=\"0\" cellpadding=\"0\">\n" +
                            "   <thead >\n" +
                            "    <tr style=\"font-weight: bold;\">\n" +
                            "       <td style=\"text-align:center;vertical-align:middle;width:70px;\" >引进类型</td>\n" +
                            "       <td style=\"text-align:center;vertical-align:middle;\" >序号</td>\n" +
                            "       <td style=\"text-align:center;vertical-align:middle;\" >品种名</td>\n" +
                            "       <td style=\"text-align:center;vertical-align:middle;\" >品牌序号</td>\n";
                      /*  if (_this.xiangmu.xiangmuleixing === "15"){
                            mmHtml += "       <td style=\"text-align:center;vertical-align:middle;width:80px;\" >物资编码</td>\n"
                        }*/
                            mmHtml +=
                                "       <td style=\"text-align:center;vertical-align:middle;\" >平台编码</td>\n" +
                                "       <td style=\"text-align:center;vertical-align:middle;\" >产品名称</td>\n" +
                                "       <td style=\"text-align:center;vertical-align:middle;\" >规格</td>\n" +
                                "       <td style=\"text-align:center;vertical-align:middle;\" >型号</td>\n" +
                                "       <td style=\"text-align:center;vertical-align:middle;\" >注册证</td>\n";
                                if(_this.xiangmuleixing!="29"){
                                    mmHtml +="       <td style=\"text-align:center;vertical-align:middle;\" >品牌名</td>\n"
                                }

                        mmHtml +=
                                "       <td style=\"text-align:center;vertical-align:middle;\" >单位</td>\n" +
                                "       <td style=\"text-align:center;vertical-align:middle;\" >单价（元）</td>\n" +
                                "       <td style=\"text-align:center;vertical-align:middle;\" >医保编码</td>\n" +
                                "       <td style=\"text-align:center;vertical-align:middle;\" >进口/国产</td>\n";
                     /*   if (_this.xiangmu.xiangmuleixing === "15"){
                            mmHtml += "       <td style=\"text-align:center;vertical-align:middle;\" >替换理由</td>\n";
                        } else {
                            mmHtml += "       <td style=\"text-align:center;vertical-align:middle;\" >备注</td>\n"
                        }*/
                            if(_this.xiangmuleixing=="24") {

                                mmHtml +=
                                "   <td style=\"text-align:center;vertical-align:middle;width:70px;\" >品牌表决</td>\n" +
                                "   <td style=\"text-align:center;vertical-align:middle;width:70px;\" >品规表决</td>\n"
                            }
                            if(_this.xiangmuleixing=="25"||_this.xiangmuleixing=="27") {

                                mmHtml +=
                                    "   <td style=\"text-align:center;vertical-align:middle;width:70px;\" >品牌表决</td>\n" +
                                "   <td style=\"text-align:center;vertical-align:middle;width:70px;\" >品规表决</td>\n"
                            }
                            if(_this.xiangmuleixing=="26"||_this.xiangmuleixing=="28") {

                                mmHtml +=
                                "   <td style=\"text-align:center;vertical-align:middle;width:70px;\" >品规表决</td>\n"
                            }
                            if(_this.xiangmuleixing=="29") {

                                mmHtml +=
                                "   <td style=\"text-align:center;vertical-align:middle;width:70px;\" >品种表决</td>\n"
                            }



                            mmHtml +="   </tr>\n" +
                            "   </thead></table></div><div class='table-body'><table style=\"table-layout: fixed;\"><tbody>";
                        if (data.Hc45List.length > 0) {
                            _this.show = true;
                            _this.yiyonghaocailist = data.ShijiList;

                            var PageInfo = data.PageInfo;
                            _this.pageIndex = PageInfo.pageIndex;
                            _this.recordCount = PageInfo.recordCount;
                            _this.pageCount = PageInfo.pageCount;


                            for (var i = 0; i < data.Hc45List.length; i++) {
                                var mmYiyonghaocai = data.Hc45List[i];
                                var mmYinjinleixing = mmYiyonghaocai.yinjinleixing;
                                var mmPinzhong = mmYiyonghaocai.pinzhongxuhao;
                                var mmPinzhongming = mmYiyonghaocai.pinzhongming;
                                var mmPinzhongresult = mmYiyonghaocai.pinzhongresult;
                                var mmPinpaiList = mmYiyonghaocai.pinpailist;
                                var mmPinzhongHebingshu = mmYiyonghaocai.pinzhonghebinghang;
                                var mmPinzhongHebinghang = "";
                                if (mmPinzhongHebingshu > 1) {
                                    mmPinzhongHebinghang = "rowspan='" + mmPinzhongHebingshu + "'";
                                } else {
                                    mmPinzhongHebinghang = "";
                                }
                                /* var mmHuanhangfu1 = "";
                                 if (i != 0) {
                                     mmHuanhangfu1 = "<tr>";
                                 }
                                 mmHtml += "<tr>";
                                 mmHtml += mmHuanhangfu1 + "<td style='text-align:center;vertical-align:middle;width: 49px;height: 100%'" + mmPinzhongHebinghang + ">" + mmPinzhong + "</td>";
 */
                                var mmpinpaixuhaos = new Array();
                                for (var m = 0; m < mmPinpaiList.length; m++) {
                                    mmpinpaixuhaos.push(mmPinpaiList[m].pinpaixuhao)
                                }
                                for (var j = 0; j < mmPinpaiList.length; j++) {
                                    var s = 0;
                                    var mmPinpailist = mmPinpaiList[j];
                                    var mmPinpai = mmPinpailist.pinpaixuhao;
                                    var mmshiyongyuanze = mmPinpailist.shiyongyuanzeid;
                                    var mmXinghaolist = mmPinpailist.xinghaolist;
                                    var mmPinpairesult = mmPinpailist.pinpairesult;
                                    var mmPinpaiHebingshu = mmPinpailist.pinpaihebinghang;
                                    var mmPinpaiHebinghang = "";
                                    if (mmPinpaiHebingshu > 1) {
                                        mmPinpaiHebinghang = "rowspan='" + mmPinpaiHebingshu + "'";
                                    } else {
                                        mmPinpaiHebinghang = "";
                                    }

                                    var mmxinghaoids = new Array();
                                    for (var l = 0; l < mmXinghaolist.length; l++) {
                                        mmxinghaoids.push(mmXinghaolist[l].id)
                                    }

                                    // console.log(mmxinghaoids);

                                    for (var k = 0; k < mmXinghaolist.length; k++) {

                                        var mmxinghaolist = mmXinghaolist[k];
                                        var mmId = mmxinghaolist.id;
                                        var mmOrdernumber = mmxinghaolist.ordernumber;
                                        var mmWuzibianma = mmxinghaolist.wuzibianma;
                                        var mmPingtaibianma = mmxinghaolist.pingtaibianma;
                                        var mmChanpinmingcheng = mmxinghaolist.chanpinmingcheng;
                                        var mmGuige = mmxinghaolist.guige;
                                        var mmXinghao = mmxinghaolist.xinghao;
                                        var mmZhucezhenghao = mmxinghaolist.zhucezheng;
                                        var mmPinpaiming = mmxinghaolist.pinpaiming;
                                        var mmShengchanshang = mmxinghaolist.shengchanchangjia;
                                        var mmJijiadanwei = mmxinghaolist.danwei;
                                        var mmPingtaidanjia = mmxinghaolist.danjia;
                                        var mmYibaobianma = mmxinghaolist.yibaobianma;
                                        var mmJinkouguochan = mmxinghaolist.guochanjinkou;
                                        var mmLiyou = mmxinghaolist.liyou;
                                        var mmBeizhu = mmxinghaolist.beizhu;
                                        var mmIsvote = mmxinghaolist.isvote;
                                        var mmResult = mmxinghaolist.result;
                                        var mmHuanhangfu3 = "";
                                        var mmerjihe = "";
                                        var mmyijihe = "";
                                        var mmsanjihe = "";
                                        var isVotebackgroundColor = "";
                                        var yibaocolor = ""
                                        if (mmIsvote === "0") {
                                            if(mmPinpai.indexOf("目录内")){
                                                isVotebackgroundColor = "background-color: #FCE4D3;"
                                            }
                                            if(mmPinpai.indexOf("拟替换")){
                                                isVotebackgroundColor = "background-color: #43a1f16e;"
                                            }
                                        }
                                        if (mmYibaobianma!="无医保") {
                                            yibaocolor = "background-color: #67c23a6b;"
                                        }
                                        if (mmPinzhong % 2 == 0) {//品种偶数行有颜色
                                            mmHuanhangfu3 += "<tr style='background-color: #f2f2f2'>"
                                        } else {
                                            mmHuanhangfu3 += "<tr>"
                                        }
                                        if (mmPinzhong % 2 == 0) {//品种偶数行
                                            if (k != 0) {//型号不是第一行
                                                mmHuanhangfu3 = "<tr style='background-color: #f2f2f2'>";
                                            } else {//型号第一行
                                                mmerjihe = "<td style='text-align:center;vertical-align:middle;"+ isVotebackgroundColor + "height: 100%'  rowspan='" + mmPinpaiHebingshu + "'>" + mmPinpai + "</td>";
                                            }
                                        } else {//品种奇数行
                                            if (k != 0) {
                                                mmHuanhangfu3 = "<tr>";
                                            } else {
                                                mmerjihe = "<td style='text-align:center;vertical-align:middle;"+ isVotebackgroundColor + "height: 100%'  rowspan='" + mmPinpaiHebingshu + "'>" + mmPinpai + "</td>";
                                            }
                                        }
                                        /* if (k != 0) {
                                             mmHuanhangfu3 = "<tr>";
                                         }else{
                                             mmerjihe="<td style='text-align:center;vertical-align:middle;width: 80px;height: 100%'  rowspan='" + mmPinpaiHebingshu + "'>" + mmPinpai + "</td>";
                                         }*/
                                        if (j == 0 && s == 0) {
                                            mmyijihe = "<td style='text-align:center;vertical-align:middle;width: 70px;height: 100%'  rowspan='" + mmPinzhongHebingshu + "'>" + mmYinjinleixing + "</td>";
                                            mmyijihe += "<td style='text-align:center;vertical-align:middle;height: 100%'  rowspan='" + mmPinzhongHebingshu + "'>" + mmPinzhong + "</td>";
                                            mmyijihe += "<td style='text-align:center;vertical-align:middle;height: 100%'  rowspan='" + mmPinzhongHebingshu + "'><a style='text-align:center;vertical-align:middle;white-space:nowrap;text-overflow: ellipsis; overflow: hidden;display: -webkit-box;\n" +
                                                "  white-space: normal;\n" +
                                                "  word-wrap: break-word;\n" +
                                                "  -webkit-line-clamp: 3;\n" +
                                                "  -webkit-box-orient: vertical;'title='" + mmPinzhongming + "'>" + mmPinzhongming + "</a></td>";
                                        }
                                        // if(mmleibie=="线下-开放试剂"||mmleibie=="线下采购"||mmleibie=="线下-封闭试剂"){
                                        //     mmHtml += mmHuanhangfu3 + "<td style='text-align:center;vertical-align:middle;width:70px;background-color: #E6A23C'>" + mmleibie + "</td>";
                                        // }else{
                                        //     mmHtml += mmHuanhangfu3 + "<td style='text-align:center;vertical-align:middle;width:70px;'>" + mmleibie + "</td>";
                                        // }
                                        mmHtml += mmHuanhangfu3;
                                        /* mmHtml += "<td style='text-align:center;vertical-align:middle;width: 60px;'>" + mmOrdernumber + "</td>";*/
                                        mmHtml += mmyijihe;
                                        mmHtml += mmerjihe;
                                        if (_this.xiangmu.xiangmuleixing === "15") {
                                            mmHtml += "<td style='text-align:center;vertical-align:middle;"+ isVotebackgroundColor + "'>" + mmWuzibianma + "</td>";
                                        }
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;"+ isVotebackgroundColor + "white-space:nowrap;text-overflow: ellipsis; overflow: hidden;'><a style='text-align:center;vertical-align:middle;white-space:nowrap;text-overflow: ellipsis; overflow: hidden;display: -webkit-box;\n" +
                                            "  white-space: normal;\n" +
                                            "  word-wrap: break-word;\n" +
                                            "  -webkit-line-clamp: 3;\n" +
                                            "  -webkit-box-orient: vertical;'title='" + mmPingtaibianma + "'>" + mmPingtaibianma + "</a></td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;"+ isVotebackgroundColor + "'><a style='text-align:center;vertical-align:middle;white-space:nowrap;text-overflow: ellipsis; overflow: hidden;display: -webkit-box;\n" +
                                            "  white-space: normal;\n" +
                                            "  word-wrap: break-word;\n" +
                                            "  -webkit-line-clamp: 3;\n" +
                                            "  -webkit-box-orient: vertical;'title='" + mmChanpinmingcheng + "'>" + mmChanpinmingcheng + "</td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;"+ isVotebackgroundColor + "white-space:nowrap;text-overflow: ellipsis; overflow: hidden;'><a style='text-align:center;vertical-align:middle;white-space:nowrap;text-overflow: ellipsis; overflow: hidden;display: -webkit-box;\n" +
                                            "  white-space: normal;\n" +
                                            "  word-wrap: break-word;\n" +
                                            "  -webkit-line-clamp: 3;\n" +
                                            "  -webkit-box-orient: vertical;'title='" + mmGuige + "'>" + mmGuige + "</a></td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;"+ isVotebackgroundColor + "white-space:nowrap;text-overflow: ellipsis; overflow: hidden;'><a style='text-align:center;vertical-align:middle;white-space:nowrap;text-overflow: ellipsis; overflow: hidden;display: -webkit-box;\n" +
                                            "  white-space: normal;\n" +
                                            "  word-wrap: break-word;\n" +
                                            "  -webkit-line-clamp: 3;\n" +
                                            "  -webkit-box-orient: vertical;'title='" + mmXinghao + "'>" + mmXinghao + "</a></td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;"+ isVotebackgroundColor + "'>" + mmZhucezhenghao + "</td>";
                                        if(_this.xiangmuleixing!="29")mmHtml += "<td style='text-align:center;vertical-align:middle;"+ isVotebackgroundColor + "'>" + mmPinpaiming + "</td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;"+ isVotebackgroundColor + "'>" + mmJijiadanwei + "</td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;"+ isVotebackgroundColor + "white-space:nowrap;text-overflow: ellipsis; overflow: hidden;'><a style='text-align:center;vertical-align:middle;white-space:nowrap;text-overflow: ellipsis; overflow: hidden;display: -webkit-box;\n" +
                                            "  white-space: normal;\n" +
                                            "  word-wrap: break-word;\n" +
                                            "  -webkit-line-clamp: 3;\n" +
                                            "  -webkit-box-orient: vertical;'title='" + mmPingtaidanjia + "'>" + mmPingtaidanjia + "</a></td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;"+ (yibaocolor==""?isVotebackgroundColor:yibaocolor) + "white-space:nowrap;text-overflow: ellipsis; overflow: hidden;'><a style='text-align:center;vertical-align:middle;white-space:nowrap;text-overflow: ellipsis; overflow: hidden;display: -webkit-box;\n" +
                                            "  white-space: normal;\n" +
                                            "  word-wrap: break-word;\n" +
                                            "  -webkit-line-clamp: 3;\n" +
                                            "  -webkit-box-orient: vertical;'title='" + mmYibaobianma + "'>" + mmYibaobianma + "</a></td>";                                        // mmHtml += "<td style='text-align:center;vertical-align:middle;white-space:nowrap;text-overflow: ellipsis; overflow: hidden;'><a title='" + mmYibaobianma + "'>" + mmYibaobianma + "</a></td>";
                                        mmHtml += "<td style='text-align:center;vertical-align:middle;"+ isVotebackgroundColor + "'>" + mmJinkouguochan + "</td>";
                                      /*  if (_this.xiangmu.xiangmuleixing === "15") {
                                            mmHtml += "<td style='text-align:center;vertical-align:middle;"+ isVotebackgroundColor + "'>" + mmLiyou + "</td>";
                                        } else {
                                            mmHtml += "<td style='text-align:center;vertical-align:middle;"+ isVotebackgroundColor + "white-space:nowrap;text-overflow: ellipsis; overflow: hidden;'><a style='text-align:center;vertical-align:middle;white-space:nowrap;text-overflow: ellipsis; overflow: hidden;display: -webkit-box;\n" +
                                                "  white-space: normal;\n" +
                                                "  word-wrap: break-word;\n" +
                                                "  -webkit-line-clamp: 3;\n" +
                                                "  -webkit-box-orient: vertical;'title='" + mmBeizhu + "'>" + mmBeizhu + "</a></td>";
                                        }*/
                                        /*if(mmshifouyibao=="无"||mmshifouyibao==""){
                                            mmHtml += "<td style='text-align:center;vertical-align:middle;width:70px;white-space:nowrap;text-overflow: ellipsis; overflow: hidden;'><a title='" + mmshifouyibao + "'>" + mmshifouyibao + "</a></td>";
                                        }else{
                                            mmHtml += "<td style='text-align:center;vertical-align:middle;width:70px;background-color: #5daf34;white-space:nowrap;text-overflow: ellipsis; overflow: hidden;'><a title='" + mmshifouyibao + "'>" + mmshifouyibao + "</a></td>";
                                        }*/

                                        /*mmHtml += "<td style='text-align:center;vertical-align:middle;'><a style='text-align:center;vertical-align:middle;white-space:nowrap;text-overflow: ellipsis; overflow: hidden;display: -webkit-box;\n" +
                                            "  white-space: normal;\n" +
                                            "  word-wrap: break-word;\n" +
                                            "  -webkit-line-clamp: 3;\n" +
                                            "  -webkit-box-orient: vertical;' title='" + mmgongnengyongtu + "'>" + mmgongnengyongtu + "</a></td>";*/

                                        // if (mmIsvote == "1") {
                                        //     mmHtml += "<td style='text-align:center;vertical-align:middle;width:80px;background-color: #5daf34;'>" + mmIsvote + "</td>";
                                        // } else {
                                        //     mmHtml += "<td style='text-align:center;vertical-align:middle;width:80px;'>" + mmIsvote + "</td>";
                                        // }

                                        var mmPinzhongBtndiv = ""
                                        var mmPinpaiBtndiv = "";
                                        var mmResultBtndiv = "";

                                        var isDisabled = "";
                                        var isPinzhongChecked = "";
                                        var isPinpaiChecked = "";
                                        var isResultChecked = "";

                                        if (_this.issubmited) {
                                            isDisabled = "disabled";
                                        }
                                        if (mmPinzhongresult === "1") {
                                            isPinzhongChecked = "checked";
                                        }
                                        if (mmPinpairesult === "1") {
                                            isPinpaiChecked = "checked";
                                        }
                                        if (mmResult === "1") {
                                            isResultChecked = "checked";
                                        }

                                        // onclick=\"topinzhongVote('" + _this.xiangmuId + "','" + mmxinghaoids + "','" + mmPinzhong + "','" + mmpinpaixuhaos + "')\"
                                        if(_this.xiangmuleixing=="29")mmPinzhongBtndiv = "<div  id='div_" + mmPinzhong + "' style=\"text-align:center;\"><input style=\"height:20px;width: 20px;\"" + isDisabled + " " + isPinzhongChecked + " onclick=\"topinzhongVote('" + _this.xiangmuId + "','" + mmPinzhong + "')\" id='checkbox_" + mmPinzhong + "' class='cbcss' type=\"checkbox\"></div>";
                                        else mmPinzhongBtndiv = "<div  id='div_" + mmPinzhong + "' style=\"text-align:center;\"><input style=\"height:20px;width: 20px;\"" + isDisabled + " " + isPinzhongChecked + " id='checkbox_" + mmPinzhong + "' class='cbcss' type=\"checkbox\"></div>";
                                        mmPinpaiBtndiv = "<div  id='div_" + mmPinzhong + "_" + mmPinpai + "' style=\"text-align:center;\"><input style=\"height:20px;width: 20px;\" " + isDisabled + " " + isPinpaiChecked + " onclick=\"topinpaiVote('" + _this.xiangmuId + "','" + mmxinghaoids + "','" + mmPinzhong + "','" + mmPinpai + "','" + mmpinpaixuhaos + "')\" id='checkbox_" + mmPinzhong + "_" + mmPinpai + "' class='cbcss' type=\"checkbox\"></div>";
                                        mmResultBtndiv = "<div  id='div_" + mmId + "' style=\"text-align:center;\"><input style=\"height:20px;width: 20px;\" " + isDisabled + " " + isResultChecked + " onclick=\"toVote('" + _this.xiangmuId + "','" + mmId + "','" + mmxinghaoids + "','" + mmPinzhong + "','" + mmPinpai + "','" + mmpinpaixuhaos + "')\" id='checkbox_" + mmId + "' class='cbcss' type=\"checkbox\"></div>";

                                        /* if (mmshiyongyuanze!=undefined) {

                                             var mmBtn="<span><div id='div_"+ mmPinzhong + "_" +mmPinpai+"_shiyongyuanze' style=\"text-align:center;\">" + mmshiyongyuanze + "</div></span><span class=\"btn btn-primary\" style=\"\"\n" +
                                                 "                  onclick=\"toModify('"+mmId+"','"+mmPinzhong+"','"+mmPinpai+"','" + mmpinpaixuhaos + "','" + mmxinghaoids + "')\">选择</span>";
                                         } else {
                                             var mmBtn="<span><div id='div_"+ mmPinzhong + "_"+mmPinpai+"_shiyongyuanze' style=\"text-align:center;\"></div></span><span class=\"btn btn-primary\" style=\"\"\n" +
                                                 "                  onclick=\"toModify('"+mmId+"','"+mmPinzhong+"','"+mmPinpai+"','" + mmpinpaixuhaos + "','" + mmxinghaoids + "')\">选择</span>";
                                         }*/
                                        if(!(_this.xiangmuleixing=="24"||_this.xiangmuleixing=="25"||_this.xiangmuleixing=="27"||_this.xiangmuleixing=="26"||_this.xiangmuleixing=="28")){
                                            if (j === 0 && s === 0) {
                                                // if (mmIsvote === "0") {
                                                //     mmHtml += "<td style='text-align:center;vertical-align:middle;height: 100%;width: 70px;'" + mmPinzhongHebinghang + "></td>";
                                                // } else {
                                                mmHtml += "<td style='text-align:center;vertical-align:middle;height: 100%;width: 70px;'" + mmPinzhongHebinghang + ">" + mmPinzhongBtndiv + "</td>";
                                                // }
                                                s = 1;
                                            }
                                        }else s=1
                                        if(!(_this.xiangmuleixing=="26"||_this.xiangmuleixing=="28"||_this.xiangmuleixing=="29")){
                                            if (k === 0) {
                                                if (mmIsvote === "0") {
                                                    //mmHtml += "<td style='text-align:center;vertical-align:middle;height: 100%;width: 70px;"+ isVotebackgroundColor + "'" + mmPinpaiHebinghang + "></td>";
                                                    mmHtml += "<td style='text-align:center;vertical-align:middle;height: 100%;width: 70px;" + isVotebackgroundColor + "'" + mmPinpaiHebinghang + "></td>";
                                                } else {
                                                    //mmHtml += "<td style='text-align:center;vertical-align:middle;height: 100%;width: 70px;"+ isVotebackgroundColor + "'" + mmPinpaiHebinghang + ">" + mmBtn + "</td>";
                                                    mmHtml += "<td style='text-align:center;vertical-align:middle;height: 100%;width: 70px;" + isVotebackgroundColor + "'" + mmPinpaiHebinghang + ">" + mmPinpaiBtndiv + "</td>";
                                                }
                                            }
                                        }
                                        if(_this.xiangmuleixing!="29"){
                                            if (mmIsvote === "0") {
                                                mmHtml += "<td style='text-align:center;vertical-align:middle;height: 100%;width: 70px;" + isVotebackgroundColor + "'></td>";
                                            } else {
                                                mmHtml += "<td style='text-align:center;vertical-align:middle;height: 100%;width: 70px;" + isVotebackgroundColor + "'>" + mmResultBtndiv + "</td>";
                                            }
                                        }
                                        mmHtml += "</tr>";

                                    }

                                }

                            }
                        } else {
                            _this.show = false;
                        }
                        mmHtml += "</table>";
                        $("#List").html(mmHtml);
                    } else {
                        layer.alert(ppData.message);
                    }
                }

            }, "json");
        },
        chaxulist: function () {
            this.pageIndex = 1;
            this.findBiaojuelist();
            if (this.tiaojian == "其他") {
                this.tiaojian = "";
                this.pageIndex = 1;
                this.findBiaojuelist();
            }
        },
        getResultCount: function () {
            var _this = this;
            layer.open({type: 3});
            $.post('/hcjieguo/getResultCount', {
                xiangmuid: _this.xiangmuId,
                xiangmuleixing :_this.xiangmuleixing,
                userid: _this.userId,
                rdm: Math.random()
            }, function (ppData) {
                layer.closeAll("loading");
                if (ppData != null) {
                    if (ppData.result == "1") {
                        var data = ppData.resultContent;
                        _this.yitongyishu = data.yitongyiShu;
                        _this.tongyishu = data.tongyiShu;
                        _this.butongyishu = data.butongyiShu;
                        _this.total = data.total;
                    } else {
                        layer.alert(ppData.message);
                    }
                }
            }, "json");
        },
        toVoteAll:function (ppresult){

            var _this = this;
            var mmMessage="";
            if("0"==ppresult){
                mmMessage="确定全部不同意当前表决项？";
            }else if("1"==ppresult){
                mmMessage="确定全部同意当前表决项？";
            }
            layer.confirm(mmMessage,{
                btn : ['是','否']
            },function(){
                layer.open({type:3});
                $.post("/jieguo/toupiao_all2", {
                    xiangmuid :_this.xiangmuId,
                    userid :_this.userId,
                    result:ppresult,
                    random : Math.random()
                }, function(ppData) {
                    if (ppData != null) {
                        layer.closeAll("loading");

                        if(ppData.result != "1"){
                            layer.alert(ppData.message);
                        }else{
                            layer.open({
                                time:1000,
                                btn:[],
                                content:"操作成功!",
                            });
                            window.location.reload();

                        }
                    }
                },"json");
            })
        },
        checkIsSubmited: function () {
            var _this = this;
            layer.open({type: 3});
            $.post('/renyuanfenpei/checkIsSubmited', {
                xiangmuid: _this.xiangmuId,
                userid: _this.userId,
                rdm: Math.random()
            }, function (ppData) {
                layer.closeAll("loading");
                if (ppData != null) {
                    if (ppData.result == "1") {
                        if (ppData.resultContent == "1") {
                            _this.issubmited = true;
                        }
                    } else {
                        layer.alert(ppData.message);
                    }
                }
            }, "json");
        },
        tosubmit: function () {
            var _this = this;
            layer.confirm("请核对信息，提交之后不能修改吗？", {
                btn: ['是', '否']
            }, function () {
                layer.open({type: 3});

                $.post('/hcjieguo/submittishi', {
                    xiangmuid: _this.xiangmuId,
                    xiangmuleixing: _this.xiangmuleixing,
                    userid: _this.userId,
                    rdm: Math.random()
                }, function (ppData) {
                    layer.closeAll("loading");
                    if (ppData != null) {
                        if (ppData.result == "1") {
                            date=ppData.resultContent;
                            if(_this.xiangmuleixing=="24"){
                                layer.alert("品种"+date+"至少需要勾选一个")
                                return
                            }
                            layer.confirm("品种"+date+"未勾选，确认提交吗？", {
                                btn: ['是', '否']
                            }, function () {
                                layer.open({type: 3});
                                $.post('/hcjieguo/submit', {
                                    xiangmuid: _this.xiangmuId,
                                    xiangmuleixing: _this.xiangmuleixing,
                                    userid: _this.userId,
                                    rdm: Math.random()
                                }, function (ppData) {
                                    layer.closeAll("loading");
                                    if (ppData != null) {
                                        if (ppData.result == "1") {
                                            _this.issubmited = true;
                                            layer.alert("提交成功");
                                            _this.findIsacticed();

                                        } else {
                                            layer.alert(ppData.message);
                                        }
                                    }
                                }, "json");
                            })

                        } else {
                                $.post('/hcjieguo/submit', {
                                    xiangmuid: _this.xiangmuId,
                                    xiangmuleixing: _this.xiangmuleixing,
                                    userid: _this.userId,
                                    rdm: Math.random()
                                }, function (ppData) {
                                    layer.closeAll("loading");
                                    if (ppData != null) {
                                        if (ppData.result == "1") {
                                            _this.issubmited = true;
                                            layer.alert("提交成功");
                                            _this.findIsacticed();

                                        } else {
                                            layer.alert(ppData.message);
                                        }
                                    }
                                }, "json");
                        }
                    }
                }, "json");
            })
        },
        remove: function () {
            this.tiaojian = "";
            this.pageIndex = 1;
            this.findBiaojuelist();
        },
        toVoteSure: function () {
            var _this = this;
            layer.open({type: 3});
            $.post('/hcjieguo/votesure', {
                xiangmuid: _this.xiangmuId,
                tiaojian: _this.tiaojian,
                userid: _this.userId,
                rdm: Math.random()
            }, function (ppData) {
                layer.closeAll("loading");
                if (ppData != null) {
                    if (ppData.result == "1") {
                        layer.alert("勾选成功");
                        _this.findIsacticed();
                    } else {
                        layer.alert(ppData.message);
                    }
                }
            }, "json");
        },
        bindShiyongyuanze: function () {
            // this.$refs.selectRef.toggleMenu();
            var _this = this;
            layer.open({type: 3});
            $.post('/yiyongyuanze/find_one', {
                detailid: _this.detailid,
                pinzhong: _this.pinzhong,
                pinpai: _this.pinpai,
                xiangmuid: _this.xiangmuId,
                userid: _this.userId,
                rdm: Math.random()
            }, function (ppData) {
                layer.closeAll("loading");
                if (ppData != null) {
                    if (ppData.result == "1") {
                        _this.syyz_value = []
                        var data = ppData.resultContent;
                        _this.yiyongyuanze = data;
                        //console.log(ppData.resultContent[0].shiyongyuanzeid)
                        // $("#shiyongyuanze").selectpicker('val', []);//否则下拉框旧值不刷新
                        // $("#shiyongyuanze").selectpicker('refresh');
                        //render方法强制重新渲染引导程序 - 选择ui,如果当您编程时更改任何相关值而影响元素布局，这将非常有用。
                        // $("#shiyongyuanze").selectpicker('render');
                        _this.initDict();
                        if (data.length > 0) {
                            _this.syyz_value = ppData.resultContent[0].shiyongyuanzeid.split(',')
                            /*  var arr=data.shiyongyuanze.split(',');
                              _this.yiyongyuanze.shiyongyuanze=arr;
                              $("#shiyongyuanze").selectpicker('val', arr);*/
                        } else {
                            /* _this.initDict();*/
                            _this.yiyongyuanze.shiyongyuanze = [];
                        }
                    } else {
                        layer.alert(ppData.message);
                    }
                }
            }, "json");
        },
        modifyShiyongyuanze: function () {
            var _this = this;
            if (_this.syyz_value.join(',') == "") {
                layer.alert("请选择适用原则再保存。");
                return false;
            }
            var shiyongyuanze = _this.syyz_value.join(',');
            $.post('/yiyongyuanze/jiancha', {
                detailid: _this.detailid,
                pinzhong: _this.pinzhong,
                pinpai: _this.pinpai,
                xiangmuid: _this.xiangmuId,
                userid: _this.userId,
                shiyongyuanzeid: _this.syyz_value.join(','),
                rdm: Math.random()
            }, function (ppData) {
                layer.closeAll("loading");
                if (ppData != null) {
                    if (ppData.result == "1") {
                        $.post('/yiyongyuanze/save', {
                            id: _this.ids,
                            pinzhong: _this.pinzhong,
                            pinpai: _this.pinpai,
                            xiangmuid: _this.xiangmuId,
                            userid: _this.userId,
                            shiyongyuanzeid: _this.syyz_value.join(','),
                            rdm: Math.random()
                        }, function (ppData) {
                            layer.closeAll("loading");
                            if (ppData != null) {
                                if (ppData.result == "1") {
                                    layer.open({
                                        time: 1000,
                                        btn: [],
                                        content: "保存成功!",
                                    });
                                    $("#editShiyongyuanzeModal").modal("hide");
                                    _this.getResultCount();
                                    pinzhongChecked="checked";
                                    pinpaiChecked = "checked";
                                    $("#div_" + _this.pinzhong + "_" + _this.pinpai + "_shiyongyuanze").html(shiyongyuanze);
                                    $("#div_" + _this.pinzhong + "").html("<input style=\"height:20px;width: 20px;\"  checked  id='checkbox_' " + pinzhongChecked + "  class='cbcss' type=\"checkbox\">");
                                    $("#div_" + _this.pinzhong + "_" + _this.pinpai + "").html("<input style=\"height:20px;width: 20px;\"  " + pinpaiChecked + "  onclick=\"topinpaiVote('" + _this.xiangmuId + "','" + _this.ids + "','" + _this.pinzhong + "','" + _this.pinpai + "','" + _this.pinpaixuhaos + "')\" id='checkbox_" + _this.pinzhong + "_" + _this.pinpai + "' class='cbcss' type=\"checkbox\">");

                                    var xinghaoIds = _this.ids.split(",");
                                    for (var i = 0; i < xinghaoIds.length; i++) {
                                        $("#div_"+xinghaoIds[i]+"").html("<input style=\"height:20px;width: 20px;\"  " + pinpaiChecked + "  onclick=\"toVote('"+_this.xiangmuId+"','"+xinghaoIds[i]+"','"+xinghaoIds+"','"+_this.pinzhong+"','"+_this.pinpai+"','" + _this.pinpaixuhaos +"')\" id='checkbox_"+xinghaoIds[i]+"' class='cbcss' type=\"checkbox\">");
                                    }
                                    //$("#div_"+_this.detailid+"").html("<input style=\"height:20px;width: 20px;\"  checked onclick=\"toVote('"+_this.xiangmuId+"','"+_this.detailid+"','"+_this.ids+"','"+_this.pinzhong+"','"+_this.pinpai+"','" + _this.pinpaixuhaos + "')\" id='checkbox_"+_this.detailid+"' class='cbcss' type=\"checkbox\">");
                                } else {
                                    layer.alert(ppData.message);
                                }
                            }
                        }, "json");
                    } else {
                        /* layer.alert(ppData.message);*/
                        layer.confirm(ppData.message, {
                            btn: ['是', '否']
                        }, function () {
                            layer.open({type: 3});

                            $.post('/yiyongyuanze/save', {
                                id: _this.ids,
                                pinzhong: _this.pinzhong,
                                pinpai: _this.pinpai,
                                xiangmuid: _this.xiangmuId,
                                userid: _this.userId,
                                shiyongyuanzeid: _this.syyz_value.join(','),
                                rdm: Math.random()
                            }, function (ppData) {
                                layer.closeAll("loading");
                                if (ppData != null) {
                                    if (ppData.result == "1") {
                                        layer.open({
                                            time: 1000,
                                            btn: [],
                                            content: "保存成功!",
                                        });
                                        $("#editShiyongyuanzeModal").modal("hide");
                                        _this.getResultCount();
                                        $("#div_" + _this.pinzhong + "_" + _this.pinpai + "_shiyongyuanze").html(shiyongyuanze);
                                        $("#div_" + _this.pinzhong + "").html("<input style=\"height:20px;width: 20px;\"  checked  id='checkbox_" + _this.pinzhong + "' class='cbcss' type=\"checkbox\">");
                                        $("#div_" + _this.pinzhong + "_" + _this.pinpai + "").html("<input style=\"height:20px;width: 20px;\"  checked onclick=\"topinpaiVote('" + _this.xiangmuId + "','" + _this.detailid + "','" + _this.pinzhong + "','" + _this.pinpai + "','" + _this.pinpaixuhaos + "')\" id='checkbox_" + _this.pinzhong + "_" + _this.pinpai + "' class='cbcss' type=\"checkbox\">");

                                        var xinghaoIds = _this.ids.split(",");
                                        for (var i = 0; i < xinghaoIds.length; i++) {
                                            $("#div_"+xinghaoIds[i]+"").html("<input style=\"height:20px;width: 20px;\" checked onclick=\"toVote('"+_this.xiangmuId+"','"+xinghaoIds[i]+"','"+xinghaoIds+"','"+_this.pinzhong+"','"+_this.pinpai+"','" + _this.pinpaixuhaos +"')\" id='checkbox_"+xinghaoIds[i]+"' class='cbcss' type=\"checkbox\">");
                                        }
                                    } else {
                                        layer.alert(ppData.message);
                                    }
                                }
                            }, "json");
                        })


                    }
                }
            }, "json");
        },
        /*modifyShiyongyuanze:function (){
            var _this = this;
            if(_this.syyz_value.join(',')==""){
                layer.alert("请选择适用原则再保存。");
                return false;
            }
            var shiyongyuanze=_this.syyz_value.join(',');

            $.post('/yiyongyuanze/save', {
                detailid : _this.detailid,
                pinzhong : _this.pinzhong,
                pinpai : _this.pinpai,
                xiangmuid: _this.xiangmuId,
                userid:_this.userId,
                shiyongyuanzeid: _this.syyz_value.join(','),
                rdm : Math.random()
            },function(ppData) {
                layer.closeAll("loading");
                if(ppData != null){
                    if(ppData.result == "1"){
                        layer.open({
                            time:1000,
                            btn:[],
                            content:"保存成功!",
                        });
                        $("#editShiyongyuanzeModal").modal("hide");
                        _this.getResultCount();
                        $("#div_"+_this.detailid+"_shiyongyuanze").html(shiyongyuanze);
                        $("#div_"+_this.pinzhong+"_"+ _this.pinpai+"").html("<input style=\"height:20px;width: 20px;\"  checked onclick=\"toVote('"+ _this.detailid+"','"+ _this.pinzhong+"','"+ _this.pinpai+"')\" id='checkbox_"+_this.pinzhong+"_"+_this.pinpai+"' class='cbcss' type=\"checkbox\">");
                    }else{
                        layer.alert(ppData.message);
                    }
                }
            },"json");
        },*/


        //跳到首页
        SetPageIndex: function () {
            this.pageIndex = 1;
        },
        SetPageEnd: function () {
            this.pageIndex = this.pageCount;
        },
        //上一页
        SetPageIndexPrePage: function () {
            var PrePage = ((this.pageIndex - 1) <= 0) ? 1 : (this.pageIndex - 1);
            this.pageIndex = PrePage;
        },
        //下一页
        SetPageIndexNextPage: function () {
            var NextPage = ((this.pageIndex + 1) >= this.pageCount) ? this.pageCount : (this.pageIndex + 1);
            this.pageIndex = NextPage;
        },
        //跳转界面
        JumpPage: function () {
            if (this.inputPageIndexValue <= 1) {
                this.inputPageIndexValue = 1;
            } else if (this.inputPageIndexValue >= this.pageCount) {
                this.inputPageIndexValue = this.pageCount;
            }
            this.pageIndex = this.inputPageIndexValue;
            this.inputPageIndexValue = '';
        },
    },
    watch: {
        //监控分页情况，刷新列表
        pageIndex: function () {

            this.findBiaojuelist();
        }
    }
})